﻿using LServer.Core.Logger;
using LServer.Model.Managers;
using LServer.Model;

namespace LServer.WebAccount
{
    public class Startup
    {
        public IConfiguration Configuration { get;}

        public Startup(IConfiguration configuration) 
        {
            Configuration = configuration;
        }

        public void ConfigureServices(IServiceCollection services) 
        {
            services.AddControllers();
        }

        public void Configure(IApplicationBuilder app, IWebHostEnvironment env) 
        {
            if (env.IsDevelopment()) 
            {
                app.UseDeveloperExceptionPage();
            }

            app.UseRouting();

            app.UseAuthorization();

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllers();
            });

            ServerConfig.Init();
            ChannelConfig.Init();
            LoggerMgr.Init();
            LFRedisClient.InitRedisClient();
            DataTableManager.Init();
        }
    }
}
